//
//  LGTAboutusVC.swift
//  KJLGT
//
//  Created by jenkin on 2019/8/19.
//  Copyright © 2019年 jenkin. All rights reserved.
//

import UIKit
import WisdomHUD

class LGTAboutusVC: LGTBaseVC {

    override func viewDidLoad() {
        super.viewDidLoad()
    }
    
    override func setUI() {
        super.setUI()
        
        self.setBavBarStyle(navBarHiden: false, title: "关于我们", back: true)
        self.view.backgroundColor = ViewBackColor
        let logo:UIImageView = LGTViewCreateUtil.share.createImageViewCorner(corner: CGFloat(SizeFit(5)), imageName: "logo")
        self.view.addSubview(logo)
        logo.snp.makeConstraints { (make) in
            make.centerX.equalTo(self.view)
            make.width.height.equalTo(SizeFit(61))
            make.top.equalTo(NavBarH + SizeFit(82))
        }
        
        let versionStr = "版本号：\(AppVersion)"
        let versionLabel = LGTViewCreateUtil.share.createLabel(textAlignment: NSTextAlignment.center, textColor: TextColor, fontSize: CGFloat(SizeFit(18)), text: versionStr)
        self.view.addSubview(versionLabel)
        versionLabel.snp.makeConstraints { (make) in
            make.centerX.equalTo(self.view)
            make.top.equalTo(logo.snp_bottomMargin).offset(SizeFit(18))
            make.height.equalTo(SizeFit(18))
        }
        
        let backView:UIView = UIView.init()
        let tap:UILongPressGestureRecognizer = UILongPressGestureRecognizer.init(target: self, action: #selector(copyAction))
        tap.minimumPressDuration = 1.0
        backView.addGestureRecognizer(tap)
        backView.backgroundColor = UIColor.white
        self.view.addSubview(backView)
        backView.snp.makeConstraints { (make) in
            make.left.right.equalTo(0)
            make.top.equalTo(logo.snp_bottomMargin).offset(SizeFit(65))
            make.height.equalTo(SizeFit(46))
        }
        
        let wxDescLabel:UILabel = LGTViewCreateUtil.share.createLabel(textAlignment: NSTextAlignment.left, textColor: TextColor, fontSize: CGFloat(SizeFit(15)), text: "客服微信号")
        backView.addSubview(wxDescLabel)
        wxDescLabel.snp.makeConstraints { (make) in
            make.centerY.equalTo(backView)
            make.height.equalTo(SizeFit(15))
            make.left.equalTo(SizeFit(12))
        }
        
        let wxLabel:UILabel = LGTViewCreateUtil.share.createLabel(textAlignment: NSTextAlignment.right, textColor: TextColor, fontSize: CGFloat(SizeFit(15)), text: AppModel.share?.cs_wx ?? "")
        backView.addSubview(wxLabel)
        wxLabel.snp.makeConstraints { (make) in
            make.centerY.equalTo(backView)
            make.height.equalTo(SizeFit(15))
            make.right.equalTo(-SizeFit(12))
        }
        
        let line:UIImageView = LGTViewCreateUtil.share.createLineView()
        backView.addSubview(line)
        line.snp.makeConstraints { (make) in
            make.left.equalTo(SizeFitFloat(9))
            make.right.equalTo(-SizeFitFloat(-9))
            make.height.equalTo(1)
            make.bottom.equalTo(backView).offset(-1)
        }
    
        
        let backView2:UIView = UIView.init()
        self.view.addSubview(backView2)
        backView2.backgroundColor = UIColor.white
        backView2.snp.makeConstraints { (make) in
            make.left.right.equalTo(0)
            make.top.equalTo(backView.snp_bottomMargin) //.offset(SizeFitFloat(100))
            make.height.equalTo(SizeFit(46))
        }
        
        let brandLabel:UILabel = LGTViewCreateUtil.share.createLabel(textAlignment: NSTextAlignment.left, textColor: TextColor, fontSize: CGFloat(SizeFit(15)), text: "版权")
        backView2.addSubview(brandLabel)
        brandLabel.snp.makeConstraints { (make) in
            make.centerY.equalTo(backView2)
            make.height.equalTo(SizeFit(15))
            make.left.equalTo(SizeFit(12))
        }
        
        let brandDescLabel:UILabel = LGTViewCreateUtil.share.createLabel(textAlignment: NSTextAlignment.right, textColor: TextColor, fontSize: CGFloat(SizeFit(15)), text:"厦门铠甲网络股份有限公司")
        backView2.addSubview(brandDescLabel)
        brandDescLabel.snp.makeConstraints { (make) in
            make.centerY.equalTo(backView2)
            make.height.equalTo(SizeFit(15))
            make.right.equalTo(-SizeFit(12))
        }
    }
    
    @objc func copyAction(long:UILongPressGestureRecognizer){
        if long.state == UIGestureRecognizer.State.began{
            let board:UIPasteboard = UIPasteboard.general
            board.string = AppModel.share?.cs_wx ?? ""
            WisdomHUD.showSuccess(text: "复制成功")
        }
    }
}
